﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;

namespace DAL
{
    public class BabyDAL
    {
        SQLHelper SQLHelper = null;
        QXHelper QXHelper = null;
        public BabyDAL()
        {
            SQLHelper = new SQLHelper();
            QXHelper = new QXHelper();
        }

        #region 查询宝宝记事本
        public DataSet jhy_baby_notepad_query()
        {
            DataSet ds = new DataSet();
            string proc = "jhy_baby_notepad_query";
            ds = SQLHelper.ExecuteQueryDataSet(proc, CommandType.StoredProcedure);
            return ds;
        }
        #endregion
        #region 宝宝记事本添加记录
        public bool jhy_baby_notepad_add(string note_content, string note_userid)
        {
            bool flag = false;
            string proc = "jhy_baby_notepad_add";
            SqlParameter[] spa = new SqlParameter[] {
                new SqlParameter("@note_content",note_content),
                new SqlParameter("@note_userid",note_userid)
            };
            int res = SQLHelper.ExecuteNonQuery(proc, spa, CommandType.StoredProcedure);
            if (res > 0)
            {
                flag = true;
            }
            return flag;
        }
        #endregion
        #region 宝宝记事本修改记录
        public bool jhy_baby_notepad_edit(string note_id, string note_content)
        {
            bool flag = false;
            string proc = "jhy_baby_notepad_edit";
            SqlParameter[] spa = new SqlParameter[] {
                new SqlParameter("@note_id",note_id),
                new SqlParameter("@note_content",note_content)
            };
            int res = SQLHelper.ExecuteNonQuery(proc, spa, CommandType.StoredProcedure);
            if (res > 0)
            {
                flag = true;
            }
            return flag;
        }
        #endregion
        #region 宝宝记事本删除记录
        public bool jhy_baby_notepad_delete(string note_id)
        {
            bool flag = false;
            string proc = "jhy_baby_notepad_delete";
            SqlParameter[] spa = new SqlParameter[] {
                new SqlParameter("@note_id",note_id)
            };
            int res = SQLHelper.ExecuteNonQuery(proc, spa, CommandType.StoredProcedure);
            if (res > 0)
            {
                flag = true;
            }
            return flag;
        }
        #endregion
        #region 宝宝记事本操作
        public bool jhy_baby_notepad_done(string note_id, string note_state)
        {
            bool flag = false;
            string proc = "jhy_baby_notepad_done";
            SqlParameter[] spa = new SqlParameter[] {
                new SqlParameter("@note_id",note_id),
                new SqlParameter("@note_state",note_state)
            };
            int res = SQLHelper.ExecuteNonQuery(proc, spa, CommandType.StoredProcedure);
            if (res > 0)
            {
                flag = true;
            }
            return flag;
        }
        #endregion

    }
}
